package cn.wolfcode.trip.base.domain;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.List;

@Getter
@Setter
@JsonIgnoreProperties({"personName","handler"})
public class Comment extends BaseDomain{

    //这边针对评论的类型给出一些常量值
    public static final Integer COMMENTTYPE_IN_TRAVEL = 1 ;//游记
    public static final Integer COMMENTTYPE_IN_STRATEGY_COMMENT = 2 ;//攻略点评
    public static final Integer COMMENTTYPE_IN_DAILY = 3 ;//日报
    public static final Integer COMMENTTYPE_IN_COMMENT = 4 ;//评论

    private String content;//评论的内容


    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date creatTime;//评论生成的时间

    private Integer commenttype;//评论的事物类型

    private User user ;//关联评论的用户

    private Travel travel ;//关联被评论的游记

    private StrategyComment strategyComment ;//关联被评论的点评

    private Daily daily ;//关联被评论的日报

    //接收父评论id的对象，用作新增的时候增加数据的
    private Comment comment ;

    private List<Comment> comments ;//关联当前评论的评论

    public String getCreatTimeMsg(){
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String msg = "假的时间" ;
        if(creatTime!=null){
            msg =  format.format(creatTime);
        }
        return msg ;
    }

}